package parseAndHandleTool;

import com.oocl.crm_system.Customer;
import com.oocl.crm_system.DoublyList;
import com.oocl.crm_system.Node;

public class ParseCmdForDelete extends ParseCmd{
	/**
	 * 
	 * @param list
	 * @param inputByConsole
	 * @return void
	 * @Description delete the customer from system
	 */
	public void parseCmdForDelete(DoublyList<Customer> list,String inputByConsole){
		String input = inputByConsole;
		input = input.substring(2);
		
		int id = Integer.parseInt(input);
		
		for(int i = 0; i < list.nodeNum; i++){
			Node<Customer> delNode = list.findNodeByIndex(i);
			if((delNode.value).getId() == id)
				list.delNode(delNode.value);            //delete the customer who's id is 123
		}
	}
}
